package com.qf.openapi.web.master.jsoup;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.junit.Test;

import java.io.IOException;

public class HelloJsoup {

    @Test
    public void name() throws IOException {
        Document doc = Jsoup.connect("http://fjisu2.com/acg/3736/").get();

//        System.out.println(doc);

        Elements elements = doc.select("ul.details-con2-list");
        for (Element element : elements) {
//            System.out.println(element);
            Element li = element.selectFirst("li");
            System.out.println(li.text());
//            element.select("")
        }
    }


    @Test
    public void testLast() throws IOException {
//        Connection doc = Jsoup.connect("http://www.gxcdncp.com/play/405-1-984.html");

        Document doc = Jsoup.connect("http://www.imitui.com/manhua/haizeiwang/").get();

//        System.out.println(doc);

        Element element = doc.selectFirst("ul.details-con2-list");
        System.out.println(element);

        Elements lis = element.select("li");
//        System.out.println(lis.size());

        Element last = lis.last();

//        System.out.println(last);

        Elements a = last.select("a");
        System.out.println(a);

    }
}
